import unittest
from Base.BaseSetting import *
import ddt


from Business.Employ_Management_SHL import Employ_Management_SHL


@ddt.ddt
class testwoniu(unittest.TestCase):
    @classmethod
    def setUpClass(cls) -> None:
        cls.ru = Employ_Management_SHL()

    def test_employ_joincompany(self):
        """就业管理——按条件查询学员就业信息是否成功"""
        author = '舒慧玲'
        module = '就业管理'
        result = self.ru.search_join_company(10,1, "WN00000")
        # print(result)
        a = result.get("list")
        # print(a)
        for i in a:
            self.assertEqual(i.get("orientation"), "公共")
            self.assertEqual(i.get("re_compu"), "2")



    @ddt.file_data(TestData_dir +'./employ_add_comp_shl.json')
    def test_employ_add_cooperation(self,**kwargs):
        """就业管理——新增合作企业信息是否成功"""
        author = '舒慧玲'
        module = '就业管理'

        result = self.ru.add_cooperation_company(kwargs.get("com_name"), kwargs.get("instury"), kwargs.get("address"),
                                                 kwargs.get("contenter"), kwargs.get("phone"))
        # print(result)
        self.assertEqual(result, kwargs.get("expect"))

    def test_employ_add_student_salary(self):  # 添加入职信息
        """就业管理——查询学员入职企业信息是否成功"""
        author = '舒慧玲'
        module = '就业管理'
        result = self.ru.add_student_salary(10,1,1, 'WN00000')
        # print(result)
        a = result.get("list")
        # print(a)
        for i in a:
            self.assertEqual(i.get("class_no"), "WN00000")


    @ddt.file_data(TestData_dir +'./test_employ_alter_shl.json')
    def test_employ_alter_companyinfo(self, **kwargs):
        """就业管理——修改合作企业信息是否成功"""
        author = '舒慧玲'
        module = '就业管理'
        result = self.ru.alter_company_info(kwargs.get("com_name"), kwargs.get("contenter"))
        # print(kwargs)
        self.assertEqual(result, kwargs.get("expect"))

    def test_employ_search_company(self):
        """就业管理——按条件查询就业企业信息是否成功"""
        author = '舒慧玲'
        module = '就业管理'
        result = self.ru.search_company(10,1)
        # print(result)
        a = result.get("list")
        # print(a)
        self.assertEqual(a[0]["ent_name"], "阿里巴巴")


if __name__ == '__main__':
    unittest.main()
